Skip to content

Payment module#94

Merged
b3y0urs3lf merged 16 commits into
sdk-2-0from
issue-91
Feb 12, 2026
Merged

Payment module#94
b3y0urs3lf merged 16 commits into
sdk-2-0from
issue-91

Conversation

@martti007

@martti007 martti007 commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

Task #91
Added assets support and token splits
Fix for TransferTransaction to give error when invalid owner predicate is used.
Fix for state hash calculations

@martti007
martti007 requested a review from Copilot January 28, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a payment module with support for asset management and token splitting functionality. The changes introduce new data structures for payment assets, token split operations with Merkle tree-based verification, and updates to transaction handling to support these features.

Changes:

  • Added payment asset infrastructure (AssetId, Asset, PaymentAssetCollection) for managing fungible tokens
  • Implemented token splitting functionality with cryptographic proofs using sparse Merkle trees
  • Updated transaction classes to include sourceStateHash as a direct property instead of computing it on-demand

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/functional/payment/TestSplitPaymentData.ts Test helper class for split payment data serialization
tests/functional/payment/TestPaymentData.ts Test helper class for payment data serialization
tests/functional/payment/SplitBuilderTest.ts Functional tests for token splitting with validation checks
tests/functional/TransitionFlowTest.ts Updated test to use factory method and added double-spend test
tests/functional/TestAggregatorClient.ts Updated to use PayToPublicKeyPredicate.TYPE constant
src/util/InclusionProofUtils.ts Added blank line for formatting
src/transaction/TransferTransaction.ts Added predicate validation check
src/transaction/TokenId.ts Removed unused fromNameTag method
src/transaction/Token.ts Added id and type getter properties
src/transaction/MintTransaction.ts Added sourceStateHash property and updated calculation
src/transaction/ITransaction.ts Added sourceStateHash to interface
src/transaction/CertifiedMintTransaction.ts Added sourceStateHash getter
src/predicate/builtin/PayToPublicKeyPredicate.ts Updated to use sourceStateHash property
src/predicate/builtin/BuiltInPredicateVerifierFactory.ts Added factory method using TYPE constant
src/payment/predicate/builtin/BurnPredicate.ts New predicate type for burn operations
src/payment/error/TokenAssetValueMismatchError.ts Error class for asset value mismatches
src/payment/error/TokenAssetMissingError.ts Error class for missing assets
src/payment/error/TokenAssetCountMismatchError.ts Error class for asset count mismatches
src/payment/asset/PaymentAssetCollection.ts Collection class for managing payment assets
src/payment/asset/AssetId.ts Identifier class for fungible assets
src/payment/asset/Asset.ts Class representing a fungible asset with id and value
src/payment/TokenSplit.ts Core implementation of token splitting with Merkle proof verification
src/payment/SplitReasonProof.ts Proof data for token split verification
src/payment/SplitReason.ts Container for split reason token and proofs
src/payment/ISplitPaymentData.ts Interface for payment data with split reason
src/payment/IPaymentData.ts Base interface for payment data
src/api/StateId.ts Updated to use sourceStateHash property
src/api/CertificationData.ts Updated to use sourceStateHash property

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/payment/predicate/builtin/BurnPredicate.ts Outdated
Comment thread src/payment/asset/AssetId.ts Outdated
Comment thread src/payment/asset/AssetId.ts
Comment thread src/payment/TokenSplit.ts
@martti007
martti007 requested a review from Copilot January 28, 2026 08:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/payment/asset/AssetId.ts

@MastaP MastaP left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there e2e tests to run against the real aggregator?

Comment thread src/payment/asset/PaymentAssetCollection.ts Outdated
}

public get(id: AssetId): Asset | null {
return this._assets.get(HexConverter.encode(id.bytes)) ?? null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id.toString()?

Comment thread tests/functional/TransitionFlowTest.ts Outdated
@b3y0urs3lf
b3y0urs3lf merged commit 27f09f6 into sdk-2-0 Feb 12, 2026
1 check passed
@b3y0urs3lf
b3y0urs3lf deleted the issue-91 branch February 12, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants